<template>
	<view class="" :style="{'--bgcolor':vuex_config.themeColor1}">
		<view class="index-box" >
		  <view class="img-list">
		    <block v-for="(item, index) in dataForm.img" :key="index">
		      <image class="img-item" :src="$formatImg(item)" mode="widthFix"></image>
		    </block>
		  </view>
		  <view class="title u-font-32 fw-bold">{{dataForm.name}}</view>
		  <view class="remark u-font-28 c-66">{{dataForm.remark}}</view>
		</view>
		<view class="btn_relative">
			<view class="btn" @click="goToMini">立即查看</view>
		</view>
	</view>
 
</template>
<script>
import {wxConfig} from "../../../../mixins/wxConfig";

export default {
  mixins: [wxConfig],
  data() {
    return {
      dataForm: {}
    }
  },
  onLoad: function (options) {
    if (options.id) {
      this.initPage(options.id)
      // #ifdef H5
      this.initWxConfig([], ['wx-open-launch-weapp'])
      // #endif
    }
  },
  methods: {
    //初始化页面数据
    initPage(id) {
      this.$resPost('GetProductExtensionInfo', {pk_id: id}).then(({data}) => {
        data.img = data.img ? data.img.split(',') : []
        this.dataForm = {...data}
      })
    },
	// 跳转其他小程序
	goToMini() {
		if(this.vuex_businessObj.appid == this.dataForm.appid){
			uni.navigateTo({
				url:this.dataForm.url,
				fail:()=>{
					this.$linkTo('index')
				}
			})
		}else{
			uni.navigateToMiniProgram({
				appId: this.dataForm.appid,
				path: this.dataForm.url,
				success: res => {},
				fail:(err)=>{
					console.log('错误',err)
				}
			});
		}
	}
  }
}
</script>
<style lang="scss" scoped>
  .index-box {
    padding: 24rpx 24rpx 0;
    line-height: 1.8;
	
  }
  .btn_relative{
	height: 80rpx;
	padding-bottom: 0;
	padding-bottom: constant(safe-area-inset-bottom);
	padding-bottom: env(safe-area-inset-bottom);
	  .btn{
		width: 100%;
		line-height: 80rpx;
		background: var(--bgcolor);
		color: #fff;
		text-align: center;
		position: fixed;
		bottom: 0;
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	  }
  }
</style>
